﻿@model PuroGame.ViewData.Mercadao.HomeViewData
@{
    ViewBag.Title = "Cadastrar";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="~/Scripts/jquery.price_format.1.8.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
   
        $('#dropZone').filedrop({
            url: '@Url.Action("UploadFiles")',
            paramname: 'files',
            maxFiles: 4,
            dragOver: function () {
                $('#dropZone').css('background', 'blue');
            },
            dragLeave: function () {
                $('#dropZone').css('background', 'gray');
            },
            drop: function () {
                $('#dropZone').css('background', 'gray');
            },
            afterAll: function () {
                $('#dropZone').html('The file(s) have been uploaded successfully!');
            },
            uploadFinished: function (i, file, response, time) {
                $('#uploadResult').val(function (i, val) {
                    return val + (val ? '; ' : '') + response;
                });
            }
        });

        $("#Preco").priceFormat({
            prefix: 'R$ ',
            centsSeparator: ',',
            thousandsSeparator: '.',
            limit: 6
        });
    });
</script>
<style type="text/css">
    #dropZone {
        background: gray;
        border: black dashed 3px;
        width: 200px;
        padding: 50px;
        text-align: center;
        color: white;
    }
    .txt {
        width: 500px;
    }
    .txtarea {
        width: 500px;
        height: 300px;
    }
</style>
<h2>Cadastrar Anúncio</h2>
@using(Html.BeginForm("CadastrarAnuncio", "Anuncio", FormMethod.Post))
{ 
<ul>
    <li>Título: @Html.TextBoxFor(anuncio => anuncio.Titulo, new { @class = "txt" })</li>
    <li>Texto: @Html.TextAreaFor(anuncio => anuncio.Texto, new { @class = "txtarea"})</li>
    <li>Preço: @Html.TextBoxFor(anuncio => anuncio.Preco)</li>
    <li>
        <h2>Adicione no máximo 4 fotos! <br />Se colocar mais de 4 as demais serão ignoradas pelo sistema.</h2>
        <div id="dropZone">Arraste e solte as imagens aqui!</div>
        <br/>
        Arquivos enviados:
        @Html.TextBox("uploadResult", "", new { style = "display:none;" })
        <ul id="uploadResultss" style="display:none;">
 
        </ul>
    </li>
    <li><input type="submit" value="Gravar" /></li>
</ul>
}



 

